package com.feature.shop.user.api;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import com.feature.core.domain.PageVo;
import com.feature.core.domain.Response;
import com.feature.core.domain.SelectVo;
import com.feature.shop.user.api.constant.ApiNameConstant;
import com.feature.shop.user.api.request.ShopUserListRequest;
import com.feature.shop.user.api.request.ShopUserPageRequest;
import com.feature.shop.user.api.request.ShopUserRegisterRequest;
import com.feature.shop.user.api.request.ShopUserUpdateRequest;
import com.feature.shop.user.api.vo.ShopRoleVo;
import com.feature.shop.user.api.vo.ShopUserVo;

@FeignClient(contextId = "ShopUserApi", name = ApiNameConstant.APPLICATION_NAME)
public interface ShopUserApi {

    @GetMapping("/queryUserList")
    Response<List<ShopUserVo>> queryUserList(@SpringQueryMap ShopUserListRequest request);

    @GetMapping("/queryUserByName")
    Response<ShopUserVo> queryUserByName(@RequestParam("userName") String userName);

    @GetMapping("/queryUserById")
    Response<ShopUserVo> queryUserById(@RequestParam("userId") Integer userId);

    @GetMapping("/queryUserPage")
    public Response<PageVo<ShopUserVo>> queryUserPage(@SpringQueryMap ShopUserPageRequest request);

    @PostMapping("/register")
    Response<?> register(ShopUserRegisterRequest req);

    @GetMapping("/queryRoleByUserId")
    public Response<List<ShopRoleVo>> queryRoleByUserId(Integer userId);

    @PostMapping(value = "/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Response<String> uploadFile(@RequestPart("file") MultipartFile file);

    @GetMapping("/querySelectRoles")
    public Response<List<SelectVo>> querySelectRoles();

    @PostMapping("/updateUser")
    Response<?> updateUser(ShopUserUpdateRequest req);

    @PostMapping("/deleteUser")
    Response<?> deleteUser(Integer userId);
}
